home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 July: Mac OS SDK / Dev.CD Jul 97 SDK1.toast / Development Kits (Disc 1) / Interfaces&Libraries / Interfaces / AIncludes / OSA.a < prev    next >
Encoding:
Text File  |  1996-01-24  |  54.4 KB  |  1,807 lines  |  [TEXT/MPS ]

  1. ;
  2. ;    File:        OSA.a
  3. ;
  4. ;    Contains:    AppleScript Client Interfaces.
  5. ;
  6. ;    Version:    Technology:    AppleScript 1.1
  7. ;                Package:    Universal Interfaces 2.2 in “MPW” on ETO #20
  8. ;
  9. ;    Copyright:    © 1984-1995 by Apple Computer, Inc.
  10. ;                All rights reserved.
  11. ;
  12. ;    Bugs?:        If you find a problem with this file, use the Apple Bug Reporter
  13. ;                stack.  Include the file and version information (from above)
  14. ;                in the problem description and send to:
  15. ;                    Internet:    apple.bugs@applelink.apple.com
  16. ;                    AppleLink:    APPLE.BUGS
  17. ;
  18. ;
  19.  
  20.     IF &TYPE('__OSA__') = 'UNDEFINED' THEN
  21. __OSA__ SET 1
  22.  
  23.  
  24.     IF &TYPE('__ERRORS__') = 'UNDEFINED' THEN
  25.     include 'Errors.a'
  26.     ENDIF
  27. ;        include 'ConditionalMacros.a'                                ;
  28.  
  29.     IF &TYPE('__APPLEEVENTS__') = 'UNDEFINED' THEN
  30.     include 'AppleEvents.a'
  31.     ENDIF
  32. ;        include 'Types.a'                                            ;
  33. ;        include 'Memory.a'                                            ;
  34. ;            include 'MixedMode.a'                                    ;
  35. ;        include 'OSUtils.a'                                        ;
  36. ;        include 'Events.a'                                            ;
  37. ;            include 'Quickdraw.a'                                    ;
  38. ;                include 'QuickdrawText.a'                            ;
  39. ;        include 'EPPC.a'                                            ;
  40. ;            include 'AppleTalk.a'                                    ;
  41. ;            include 'Files.a'                                        ;
  42. ;                include 'Finder.a'                                    ;
  43. ;            include 'PPCToolbox.a'                                    ;
  44. ;            include 'Processes.a'                                    ;
  45. ;        include 'Notification.a'                                    ;
  46.  
  47.     IF &TYPE('__AEOBJECTS__') = 'UNDEFINED' THEN
  48.     include 'AEObjects.a'
  49.     ENDIF
  50.  
  51.     IF &TYPE('__COMPONENTS__') = 'UNDEFINED' THEN
  52.     include 'Components.a'
  53.     ENDIF
  54.  
  55. kOSAComponentType                EQU        'osa '
  56.  
  57. ; 0x73637074 
  58. kOSAGenericScriptingComponentSubtype EQU        'scpt'
  59.  
  60. ;    Type of script document files.    
  61. ; 0x6f736173 
  62. kOSAFileType                    EQU        'osas'
  63.  
  64. ;
  65. ;        Suite and event code of the RecordedText event. 
  66. ;        (See OSAStartRecording, below.)
  67. ;    
  68. ; 0x61736372 
  69. kOSASuite                        EQU        'ascr'
  70.  
  71. ; 0x72656364 
  72. kOSARecordedText                EQU        'recd'
  73.  
  74. ; Selector returns boolean 
  75. ; 0x6d6f6469 
  76. kOSAScriptIsModified            EQU        'modi'
  77.  
  78. ; Selector returns boolean 
  79. ; 0x63736372 
  80. kOSAScriptIsTypeCompiledScript    EQU        'cscr'
  81.  
  82. ; Selector returns boolean 
  83. ; 0x76616c75 
  84. kOSAScriptIsTypeScriptValue        EQU        'valu'
  85.  
  86. ; Selector returns boolean 
  87. ; 0x636e7478 
  88. kOSAScriptIsTypeScriptContext    EQU        'cntx'
  89.  
  90. ; Selector returns a DescType which may be passed to OSACoerceToDesc 
  91. ; 0x62657374 
  92. kOSAScriptBestType                EQU        'best'
  93.  
  94. ;
  95. ;        This selector is used to determine whether a script has source 
  96. ;        associated with it that when given to OSAGetSource, the call will not
  97. ;        fail.  The selector returns a boolean.
  98. ;    
  99. ; 0x67737263 
  100. kOSACanGetSource                EQU        'gsrc'
  101.  
  102. typeOSADialectInfo                EQU        'difo'                ;  0x6469666f   
  103. keyOSADialectName                EQU        'dnam'                ;  0x646e616d   
  104. keyOSADialectCode                EQU        'dcod'                ;  0x64636f64   
  105. keyOSADialectLangCode            EQU        'dlcd'                ;  0x646c6364   
  106. keyOSADialectScriptCode            EQU        'dscd'
  107.  
  108. ; typedef ComponentResult     OSAError
  109. ; Under the Open Scripting Architecture all error results are longs 
  110. ; typedef unsigned long     OSAID
  111. ;
  112. ;        OSAIDs allow transparent manipulation of scripts associated with
  113. ;         various scripting systems.
  114. ;    
  115.  
  116. kOSANullScript                    EQU        0
  117.  
  118. ; No -script constant. 
  119. kOSANullMode                    EQU        0                    ; sounds better 
  120. kOSAModeNull                    EQU        0                    ; tastes consistent 
  121.  
  122. ;
  123. ;        Some routines take flags that control their execution.  This constant
  124. ;        declares default mode settings are used.
  125. ;    
  126. ;*************************************************************************
  127. ;    Standard Script Errors
  128. ;**************************************************************************
  129. ;    It is recommended that scripting components use the following set of error
  130. ;    codes to signal failure when applicable.  This enables applications that
  131. ;    use the OSA API to deal with some class of script errors in a less than 
  132. ;    ad hoc manner.  Scripting components are of course encouraged to return
  133. ;    component-specific errors when these don't apply.
  134. ;*************************************************************************
  135. ;        Dynamic errors:
  136. ;
  137. ;    These errors result from data-dependent conditions and are typically
  138. ;    signaled at runtime.
  139. ;
  140. ;
  141. ;        Signaled when a value can't be coerced to the desired type. Similar
  142. ;          to errOSATypeError except results from coercion.
  143. ;    
  144. errOSACantCoerce                EQU        errAECoercionFail
  145.  
  146. ; Signaled when an object is not found in a container 
  147. errOSACantAccess                EQU        errAENoSuchObject
  148.  
  149. ;
  150. ;        Signaled when an object cannot be set in a container.  Same as 
  151. ;          AERegistry error errAEWriteDenied.
  152. ;    
  153. errOSACantAssign                EQU        -10006
  154.  
  155. ;
  156. ;        Signaled by user scripts or applications when no actual error code
  157. ;          is to be returned.  Simply means "an error has occurred".  Most useful
  158. ;          in conjunction with an error message from the application.
  159. ;    
  160. errOSAGeneralError                EQU        -2700
  161.  
  162. ; Signaled when there is an attempt to divide by zero 
  163. errOSADivideByZero                EQU        -2701
  164.  
  165. ; Signaled when integer or real value is too large to be represented 
  166. errOSANumericOverflow            EQU        -2702
  167.  
  168. ;
  169. ;        Signaled when application can't be launched or when it is remote and
  170. ;          program linking is not enabled.
  171. ;    
  172. errOSACantLaunch                EQU        -2703
  173.  
  174. ; Signaled when an application can't respond to AppleEvents 
  175. errOSAAppNotHighLevelEventAware    EQU        -2704
  176.  
  177. ; Signaled when an application's terminology resource is not readable 
  178. errOSACorruptTerminology        EQU        -2705
  179.  
  180. ; Signaled when the runtime stack overflows 
  181. errOSAStackOverflow                EQU        -2706
  182.  
  183. ; Signaled when a runtime internal data structure overflows 
  184. errOSAInternalTableOverflow        EQU        -2707
  185.  
  186. ;
  187. ;        Signaled when an intrinsic limitation is exceeded for the size of 
  188. ;          a value or data structure.
  189. ;    
  190. errOSADataBlockTooLarge            EQU        -2708
  191.  
  192. errOSACantGetTerminology        EQU        -2709
  193.  
  194. errOSACantCreate                EQU        -2710
  195.  
  196. ;        Component-specific dynamic script errors:
  197. ;
  198. ;    The range -2720 thru -2739 is reserved for component-specific runtime errors.
  199. ;    (Note that error codes from different scripting components in this range will
  200. ;    overlap.)
  201. ;
  202. ;        Static errors:
  203. ;
  204. ;    These errors comprise what are commonly thought of as parse and compile-
  205. ;    time errors.  However, in a dynamic system (e.g. AppleScript) any or all
  206. ;    of these may also occur at runtime.
  207. ;
  208. ; Signaled when data was not the right type and coercion is not allowed 
  209. errOSATypeError                    EQU        errAEWrongDataType
  210.  
  211. ; Signaled when a message was sent to an object that didn't handle it 
  212. OSAMessageNotUnderstood            EQU        errAEEventNotHandled
  213.  
  214. ;
  215. ;        Signaled when a function to be returned doesn't exist.  (Probably only
  216. ;          useful in languages with first-class functions that distinguish between
  217. ;          functions and other values (two name spaces). This is different from
  218. ;          errOSAMessageNotUnderstood, which may be signaled when the method is
  219. ;          invoked.
  220. ;    
  221. OSAUndefinedHandler                EQU        errAEHandlerNotFound
  222.  
  223. ; Signaled when a container can never have the requested object 
  224. OSAIllegalAccess                EQU        errAEAccessorNotFound
  225.  
  226. ; Signaled when index was out of range. Specialization of errOSACantAccess. 
  227. OSAIllegalIndex                    EQU        errAEIllegalIndex
  228.  
  229. ; Signaled when a range is screwy. Specialization of errOSACantAccess. 
  230. OSAIllegalRange                    EQU        errAEImpossibleRange
  231.  
  232. ;
  233. ;        Signaled when an object can never be set in a container.  Same as 
  234. ;          AERegistry error errAENotModifiable.
  235. ;    
  236. OSAIllegalAssign                EQU        -10003
  237.  
  238. ;
  239. ;        Signaled when a syntax error occurs. (e.g. "Syntax error" or
  240. ;         "<this> can't go after <that>").
  241. ;    
  242. OSASyntaxError                    EQU        -2740
  243.  
  244. ;
  245. ;        Signaled when another form of syntax was expected. (e.g. "expected
  246. ;          a <type> but found <this>").
  247. ;    
  248. OSASyntaxTypeError                EQU        -2741
  249.  
  250. ; Signaled when a name or number is too long to be parsed 
  251. OSATokenTooLong                    EQU        -2742
  252.  
  253. ;
  254. ;        Signaled when a parameter is missing for a function invocation.  Note
  255. ;          that in some languages, this error may occur at runtime.
  256. ;    
  257. OSAMissingParameter                EQU        errAEDescNotFound
  258.  
  259. ;
  260. ;        Signaled when function is called with the wrong number of parameters,
  261. ;          or a parameter pattern cannot be matched.
  262. ;    
  263. OSAParameterMismatch            EQU        errAEWrongNumberArgs
  264.  
  265. ;
  266. ;        Signaled when a formal parameter, local variable, or instance variable
  267. ;          is specified more than once.
  268. ;    
  269. OSADuplicateParameter            EQU        -2750
  270.  
  271. ;
  272. ;        Signaled when a formal parameter, local variable, or instance variable
  273. ;          is specified more than once.
  274. ;    
  275. OSADuplicateProperty            EQU        -2751
  276.  
  277. ;
  278. ;        Signaled when more than one handler is defined with the same name in 
  279. ;          a scope where the language doesn't allow it.
  280. ;    
  281. OSADuplicateHandler                EQU        -2752
  282.  
  283. ; Signaled when a variable is accessed that has no value 
  284. OSAUndefinedVariable            EQU        -2753
  285.  
  286. ;
  287. ;        Signaled when a variable is declared inconsistently in the same scope,
  288. ;          such as both local and global.
  289. ;    
  290. OSAInconsistentDeclarations        EQU        -2754
  291.  
  292. ;
  293. ;        Signaled when illegal control flow occurs in an application (no catcher
  294. ;          for throw, non-lexical loop exit, etc.).
  295. ;    
  296. OSAControlFlowError                EQU        -2755
  297.  
  298. ;        Component-specific static script errors:
  299. ;
  300. ;    The range -2760 thru -2779 is reserved for component-specific parsing and
  301. ;    compile-time errors. (Note that error codes from different scripting
  302. ;    components in this range will overlap.)
  303. ;
  304. ;        Dialect-specific script errors:
  305. ;
  306. ;    The range -2780 thru -2799 is reserved for dialect specific error codes for
  307. ;    scripting components that support dialects. (Note that error codes from
  308. ;    different scripting components in this range will overlap, as well as error
  309. ;    codes from different dialects in the same scripting component.)
  310. ;
  311. ;*************************************************************************
  312. ;    OSA Interface Descriptions
  313. ;**************************************************************************
  314. ;    The OSA Interface is broken down into a required interface, and several
  315. ;    optional interfaces to support additional functionality.  A given scripting
  316. ;    component may choose to support only some of the optional interfaces in
  317. ;    addition to the basic interface.  The OSA Component Flags may be used to 
  318. ;    query the Component Manager to find a scripting component with a particular
  319. ;    capability, or determine if a particular scripting component supports a 
  320. ;    particular capability.
  321. ;*************************************************************************
  322. ; OSA Component Flags: 
  323. kOSASupportsCompiling            EQU        $0002
  324. kOSASupportsGetSource            EQU        $0004
  325. kOSASupportsAECoercion            EQU        $0008
  326. kOSASupportsAESending            EQU        $0010
  327. kOSASupportsRecording            EQU        $0020
  328. kOSASupportsConvenience            EQU        $0040
  329. kOSASupportsDialects            EQU        $0080
  330. kOSASupportsEventHandling        EQU        $0100
  331.  
  332. ; Component Selectors: 
  333. kOSASelectLoad                    EQU        $0001
  334. kOSASelectStore                    EQU        $0002
  335. kOSASelectExecute                EQU        $0003
  336. kOSASelectDisplay                EQU        $0004
  337. kOSASelectScriptError            EQU        $0005
  338. kOSASelectDispose                EQU        $0006
  339. kOSASelectSetScriptInfo            EQU        $0007
  340. kOSASelectGetScriptInfo            EQU        $0008
  341. kOSASelectSetActiveProc            EQU        $0009
  342. kOSASelectGetActiveProc            EQU        $000A
  343.  
  344. ; Compiling: 
  345. kOSASelectScriptingComponentName EQU        $0102
  346. kOSASelectCompile                EQU        $0103
  347. kOSASelectCopyID                EQU        $0104
  348.  
  349. ; GetSource: 
  350. kOSASelectGetSource                EQU        $0201
  351.  
  352. ; AECoercion: 
  353. kOSASelectCoerceFromDesc        EQU        $0301
  354. kOSASelectCoerceToDesc            EQU        $0302
  355.  
  356. ; AESending: 
  357. kOSASelectSetSendProc            EQU        $0401
  358. kOSASelectGetSendProc            EQU        $0402
  359. kOSASelectSetCreateProc            EQU        $0403
  360. kOSASelectGetCreateProc            EQU        $0404
  361. kOSASelectSetDefaultTarget        EQU        $0405
  362.  
  363. ; Recording: 
  364. kOSASelectStartRecording        EQU        $0501
  365. kOSASelectStopRecording            EQU        $0502
  366.  
  367. ; Convenience: 
  368. kOSASelectLoadExecute            EQU        $0601
  369. kOSASelectCompileExecute        EQU        $0602
  370. kOSASelectDoScript                EQU        $0603
  371.  
  372. ; Dialects: 
  373. kOSASelectSetCurrentDialect        EQU        $0701
  374. kOSASelectGetCurrentDialect        EQU        $0702
  375. kOSASelectAvailableDialects        EQU        $0703
  376. kOSASelectGetDialectInfo        EQU        $0704
  377. kOSASelectAvailableDialectCodeList EQU        $0705
  378.  
  379. ; Event Handling: 
  380. kOSASelectSetResumeDispatchProc    EQU        $0801
  381. kOSASelectGetResumeDispatchProc    EQU        $0802
  382. kOSASelectExecuteEvent            EQU        $0803
  383. kOSASelectDoEvent                EQU        $0804
  384. kOSASelectMakeContext            EQU        $0805
  385.  
  386. ; scripting component specific selectors are added beginning with this value  
  387. kOSASelectComponentSpecificStart EQU        $1001
  388.  
  389. ;        Mode Flags:
  390. ;
  391. ;    Warning: These should not conflict with the AESend mode flags in
  392. ;    AppleEvents.h, because we may want to use them as OSA mode flags too.
  393. ;
  394. ;
  395. ;        This mode flag may be passed to OSALoad, OSAStore or OSACompile to
  396. ;          instruct the scripting component to not retain the "source" of an
  397. ;          expression.  This will cause the OSAGetSource call to return the error
  398. ;          errOSASourceNotAvailable if used.  However, some scripting components
  399. ;          may not retain the source anyway.  This is mainly used when either space
  400. ;          efficiency is desired, or a script is to be "locked" so that its
  401. ;          implementation may not be viewed.
  402. ;    
  403. kOSAModePreventGetSource        EQU        $00000001
  404.  
  405. ;
  406. ;        These mode flags may be passed to OSACompile, OSAExecute, OSALoadExecute
  407. ;          OSACompileExecute, OSADoScript, OSAExecuteEvent, or OSADoEvent to
  408. ;          indicate whether or not the script may interact with the user, switch
  409. ;          layer or reconnect if necessary.  Any AppleEvents will be sent with the
  410. ;          corresponding AESend mode supplied.
  411. ;    
  412. kOSAModeNeverInteract            EQU        kAENeverInteract
  413. kOSAModeCanInteract                EQU        kAECanInteract
  414. kOSAModeAlwaysInteract            EQU        kAEAlwaysInteract
  415. kOSAModeDontReconnect            EQU        kAEDontReconnect
  416.  
  417. ;
  418. ;        This mode flag may be passed to OSACompile, OSAExecute, OSALoadExecute
  419. ;          OSACompileExecute, OSADoScript, OSAExecuteEvent, or OSADoEvent to
  420. ;          indicate whether or not AppleEvents should be sent with the
  421. ;          kAECanSwitchLayer mode flag sent or not. NOTE: This flag is exactly the
  422. ;          opposite sense of the AppleEvent flag kAECanSwitchLayer.  This is to
  423. ;          provide a more convenient default, i.e. not supplying any mode
  424. ;          (kOSAModeNull) means to send events with kAECanSwitchLayer.  Supplying
  425. ;          the kOSAModeCantSwitchLayer mode flag will cause AESend to be called
  426. ;          without kAECanSwitchLayer.
  427. ;    
  428. kOSAModeCantSwitchLayer            EQU        $00000040
  429.  
  430. ;
  431. ;        This mode flag may be passed to OSACompile, OSAExecute, OSALoadExecute
  432. ;          OSACompileExecute, OSADoScript, OSAExecuteEvent, or OSADoEvent to
  433. ;          indicate whether or not AppleEvents should be sent with the kAEDontRecord
  434. ;          mode flag sent or not. NOTE: This flag is exactly the opposite sense of
  435. ;          the AppleEvent flag kAEDontRecord.  This is to provide a more convenient
  436. ;          default, i.e. not supplying any mode (kOSAModeNull) means to send events
  437. ;          with kAEDontRecord.  Supplying the kOSAModeDoRecord mode flag will 
  438. ;          cause AESend to be called without kAEDontRecord.
  439. ;    
  440. kOSAModeDoRecord                EQU        $00001000
  441.  
  442. ;
  443. ;        This is a mode flag for OSACompile that indicates that a context should
  444. ;          be created as the result of compilation. All handler definitions are
  445. ;          inserted into the new context, and variables are initialized by
  446. ;          evaluating their initial values in a null context (i.e. they must be
  447. ;          constant expressions).
  448. ;    
  449. kOSAModeCompileIntoContext        EQU        $00000002
  450.  
  451. ;
  452. ;        This is a mode flag for OSACompile that indicates that the previous
  453. ;          script ID (input to OSACompile) should be augmented with any new
  454. ;          definitions in the sourceData rather than replaced with a new script.
  455. ;          This means that the previous script ID must designate a context.
  456. ;          The presence of this flag causes the kOSAModeCompileIntoContext flag
  457. ;          to be implicitly used, causing any new definitions to be initialized
  458. ;          in a null context.
  459. ;    
  460. kOSAModeAugmentContext            EQU        $00000004
  461.  
  462. ;
  463. ;        This mode flag may be passed to OSADisplay or OSADoScript to indicate
  464. ;          that output only need be human-readable, not re-compilable by OSACompile.
  465. ;          If used, output may be arbitrarily "beautified", e.g. quotes may be left
  466. ;          off of string values, long lists may have elipses, etc.
  467. ;    
  468. kOSAModeDisplayForHumans        EQU        $00000008
  469.  
  470. ;
  471. ;        This mode flag may be passed to OSAStore in the case where the scriptID
  472. ;          is a context.  This causes the context to be saved, but not the context's
  473. ;          parent context.  When the stored context is loaded back in, the parent
  474. ;          will be kOSANullScript.
  475. ;    
  476. kOSAModeDontStoreParent            EQU        $00010000
  477.  
  478. ;
  479. ;        This mode flag may be passed to OSAExecuteEvent to cause the event to
  480. ;          be dispatched to the direct object of the event. The direct object (or
  481. ;          subject attribute if the direct object is a non-object specifier) will
  482. ;          be resolved, and the resulting script object will be the recipient of
  483. ;          the message. The context argument to OSAExecuteEvent will serve as the
  484. ;          root of the lookup/resolution process.
  485. ;    
  486. kOSAModeDispatchToDirectObject    EQU        $00020000
  487.  
  488. ;
  489. ;        This mode flag may be passed to OSAExecuteEvent to indicate that
  490. ;          components do not have to get the data of object specifier arguments.
  491. ;    
  492. kOSAModeDontGetDataForArguments    EQU        $00040000
  493.  
  494. ;*************************************************************************
  495. ;    OSA Basic Scripting Interface
  496. ;**************************************************************************
  497. ;    Scripting components must at least support the Basic Scripting interface.
  498. ;*************************************************************************
  499. ;        Loading and Storing Scripts:
  500. ;
  501. ;    These routines allow scripts to be loaded and stored in their internal
  502. ;    (possibly compiled, non-text) representation.
  503. ;
  504. ; Resource type for scripts 
  505. kOSAScriptResourceType            EQU        kOSAGenericScriptingComponentSubtype
  506.  
  507. ;
  508. ;        Default type given to OSAStore which creates "generic" loadable script
  509. ;          data descriptors.
  510. ;    
  511. typeOSAGenericStorage            EQU        kOSAScriptResourceType
  512.  
  513. ;
  514. ; pascal OSAError OSALoad(ComponentInstance scriptingComponent, const AEDesc *scriptData, long modeFlags, OSAID *resultingScriptID)
  515. ;
  516.     IF ¬ GENERATINGCFM THEN
  517.         Macro
  518.         _OSALoad
  519.             dc.w     $2F3C
  520.             dc.w     $000C
  521.             dc.w     $0001
  522.             moveq    #0,d0
  523.             dc.w     $A82A
  524.         EndM
  525.     ELSE
  526.         IMPORT_CFM_FUNCTION    OSALoad
  527.     ENDIF
  528.  
  529. ;
  530. ;        OSAComponentFunctionInline(kOSASelectLoad, 12);
  531. ;    
  532. ;        Errors:
  533. ;            badComponentInstance        invalid scripting component instance
  534. ;            errOSASystemError
  535. ;            errOSABadStorageType:        scriptData not for this scripting component
  536. ;            errOSACorruptData:            data seems to be corrupt
  537. ;            errOSADataFormatObsolete    script data format is no longer supported
  538. ;            errOSADataFormatTooNew        script data format is from a newer version
  539. ;        
  540. ;        ModeFlags:
  541. ;            kOSAModePreventGetSource
  542. ;    
  543. ;
  544. ; pascal OSAError OSAStore(ComponentInstance scriptingComponent, OSAID scriptID, DescType desiredType, long modeFlags, AEDesc *resultingScriptData)
  545. ;
  546.     IF ¬ GENERATINGCFM THEN
  547.         Macro
  548.         _OSAStore
  549.             dc.w     $2F3C
  550.             dc.w     $0010
  551.             dc.w     $0002
  552.             moveq    #0,d0
  553.             dc.w     $A82A
  554.         EndM
  555.     ELSE
  556.         IMPORT_CFM_FUNCTION    OSAStore
  557.     ENDIF
  558.  
  559. ;
  560. ;        OSAComponentFunctionInline(kOSASelectStore, 16);
  561. ;    
  562. ;        Errors:
  563. ;            badComponentInstance    invalid scripting component instance
  564. ;            errOSASystemError
  565. ;            errOSAInvalidID
  566. ;            errOSABadStorageType:    desiredType not for this scripting component
  567. ;        
  568. ;        ModeFlags:
  569. ;            kOSAModePreventGetSource
  570. ;            kOSAModeDontStoreParent
  571. ;    
  572. ; Executing Scripts: 
  573. ;
  574. ; pascal OSAError OSAExecute(ComponentInstance scriptingComponent, OSAID compiledScriptID, OSAID contextID, long modeFlags, OSAID *resultingScriptValueID)
  575. ;
  576.     IF ¬ GENERATINGCFM THEN
  577.         Macro
  578.         _OSAExecute
  579.             dc.w     $2F3C
  580.             dc.w     $0010
  581.             dc.w     $0003
  582.             moveq    #0,d0
  583.             dc.w     $A82A
  584.         EndM
  585.     ELSE
  586.         IMPORT_CFM_FUNCTION    OSAExecute
  587.     ENDIF
  588.  
  589. ;
  590. ;        OSAComponentFunctionInline(kOSASelectExecute, 16);
  591. ;        This call runs a script.  The contextID represents the environment
  592. ;        with which global variables in the script are resolved.  The constant
  593. ;        kOSANullScript may be used for the contextID if the application wishes
  594. ;        to not deal with context directly (a default one is associated with each
  595. ;        scripting component instance).  The resultingScriptValueID is the 
  596. ;        result of evaluation, and contains a value which may be displayed using
  597. ;        the OSAGetSource call.  The modeFlags convey scripting component
  598. ;        specific information.
  599. ;    
  600. ;        Errors:
  601. ;            badComponentInstance    invalid scripting component instance
  602. ;            errOSASystemError
  603. ;            errOSAInvalidID
  604. ;            errOSAScriptError:        the executing script got an error
  605. ;    
  606. ;        ModeFlags:
  607. ;            kOSAModeNeverInteract
  608. ;            kOSAModeCanInteract
  609. ;            kOSAModeAlwaysInteract
  610. ;            kOSAModeCantSwitchLayer
  611. ;            kOSAModeDontReconnect
  612. ;            kOSAModeDoRecord
  613. ;    
  614. ; Displaying results: 
  615. ;
  616. ; pascal OSAError OSADisplay(ComponentInstance scriptingComponent, OSAID scriptValueID, DescType desiredType, long modeFlags, AEDesc *resultingText)
  617. ;
  618.     IF ¬ GENERATINGCFM THEN
  619.         Macro
  620.         _OSADisplay
  621.             dc.w     $2F3C
  622.             dc.w     $0010
  623.             dc.w     $0004
  624.             moveq    #0,d0
  625.             dc.w     $A82A
  626.         EndM
  627.     ELSE
  628.         IMPORT_CFM_FUNCTION    OSADisplay
  629.     ENDIF
  630.  
  631. ;
  632. ;        OSAComponentFunctionInline(kOSASelectDisplay, 16);
  633. ;        This call is used to convert results (script value IDs) into displayable
  634. ;        text. The desiredType should be at least typeChar, and modeFlags are
  635. ;        scripting system specific flags to control the formatting of the
  636. ;        resulting text. This call differs from OSAGetSource in that (1) it
  637. ;        always produces at least typeChar, (2) is only works on script values,
  638. ;        (3) it may display it's output in non-compilable form (e.g. without
  639. ;        string quotes, elipses inserted in long and/or circular lists, etc.) and
  640. ;        (4) it is required by the basic scripting interface.
  641. ;    
  642. ;        Errors:
  643. ;            badComponentInstance    invalid scripting component instance
  644. ;            errOSASystemError
  645. ;            errOSAInvalidID
  646. ;            errAECoercionFail:        desiredType not supported by scripting component
  647. ;    
  648. ;        ModeFlags:
  649. ;            kOSAModeDisplayForHumans
  650. ;    
  651. ; Getting Error Information: 
  652. ;
  653. ; pascal OSAError OSAScriptError(ComponentInstance scriptingComponent, OSType selector, DescType desiredType, AEDesc *resultingErrorDescription)
  654. ;
  655.     IF ¬ GENERATINGCFM THEN
  656.         Macro
  657.         _OSAScriptError
  658.             dc.w     $2F3C
  659.             dc.w     $000C
  660.             dc.w     $0005
  661.             moveq    #0,d0
  662.             dc.w     $A82A
  663.         EndM
  664.     ELSE
  665.         IMPORT_CFM_FUNCTION    OSAScriptError
  666.     ENDIF
  667.  
  668. ;
  669. ;        OSAComponentFunctionInline(kOSASelectScriptError, 12);
  670. ;        Whenever script execution returns errOSAExecutionError, this routine
  671. ;        may be used to get information about that error.  The selector describes
  672. ;        the type of information desired about the error (various selectors are
  673. ;        listed below).  The desiredType indicates the data type of the result
  674. ;        desired for that selector.
  675. ;    
  676. ;        Errors:
  677. ;            badComponentInstance    invalid scripting component instance
  678. ;            errOSASystemError
  679. ;            errOSABadSelector:        selector not supported by scripting component
  680. ;            errAECoercionFail:        desiredType not supported by scripting component
  681. ;    
  682. ; OSAScriptError selectors: 
  683. ;
  684. ;        This selector is used to determine the error number of a script error.
  685. ;        These error numbers may be either system error numbers, or error numbers
  686. ;        that are scripting component specific.
  687. ;        Required desiredTypes:    
  688. ;              typeShortInteger
  689. ;    
  690. kOSAErrorNumber                    EQU        keyErrorNumber
  691.  
  692. ;
  693. ;        This selector is used to determine the full error message associated
  694. ;        with the error number.  It should include the name of the application
  695. ;        which caused the error, as well as the specific error that occurred.
  696. ;        This selector is sufficient for simple error reporting (but see
  697. ;        kOSAErrorBriefMessage, below).
  698. ;        Required desiredTypes:
  699. ;            typeChar                    error message string
  700. ;    
  701. kOSAErrorMessage                EQU        keyErrorString
  702.  
  703. ;
  704. ;        This selector is used to determine a brief error message associated with
  705. ;        the error number.  This message and should not mention the name of the
  706. ;        application which caused the error, any partial results or offending
  707. ;        object (see kOSAErrorApp, kOSAErrorPartialResult and
  708. ;        kOSAErrorOffendingObject, below).
  709. ;        Required desiredTypes:
  710. ;              typeChar                    brief error message string
  711. ;    
  712. ;  0x65727262  
  713. kOSAErrorBriefMessage            EQU        'errb'
  714.  
  715. ;
  716. ;        This selector is used to determine which application actually got the
  717. ;        error (if it was the result of an AESend), or the current application
  718. ;        if ....
  719. ;        Required desiredTypes:
  720. ;              typeProcessSerialNumber        PSN of the errant application
  721. ;              typeChar                    name of the errant application
  722. ;    
  723. ;  0x65726170  
  724. kOSAErrorApp                    EQU        'erap'
  725.  
  726. ;
  727. ;        This selector is used to determine any partial result returned by an 
  728. ;        operation. If an AESend call failed, but a partial result was returned,
  729. ;        then the partial result may be returned as an AEDesc.
  730. ;        Required desiredTypes:
  731. ;              typeBest                    AEDesc of any partial result
  732. ;    
  733. ;  0x70746c72   
  734. kOSAErrorPartialResult            EQU        'ptlr'
  735.  
  736. ;
  737. ;        This selector is used to determine any object which caused the error
  738. ;        that may have been indicated by an application.  The result is an 
  739. ;        AEDesc.
  740. ;        Required desiredTypes:
  741. ;              typeBest                    AEDesc of any offending object
  742. ;    
  743. ;  0x65726f62   
  744. kOSAErrorOffendingObject        EQU        'erob'
  745.  
  746. ;
  747. ;        This selector is used to determine the type expected by a coercion 
  748. ;        operation if a type error occurred.
  749. ;    
  750. ;  0x65727274   
  751. kOSAErrorExpectedType            EQU        'errt'
  752.  
  753. ;
  754. ;        This selector is used to determine the source text range (start and 
  755. ;        end positions) of where the error occurred.
  756. ;        Required desiredTypes:
  757. ;              typeOSAErrorRange
  758. ;    
  759. ;  0x65726e67  
  760. kOSAErrorRange                    EQU        'erng'
  761.  
  762. ;
  763. ;        An AERecord type containing keyOSASourceStart and keyOSASourceEnd fields
  764. ;        of type short.
  765. ;    
  766. ;  0x65726e67   
  767. typeOSAErrorRange                EQU        'erng'
  768.  
  769. ; Field of a typeOSAErrorRange record of typeShortInteger 
  770. ;  0x73726373    
  771. keyOSASourceStart                EQU        'srcs'
  772.  
  773. ; Field of a typeOSAErrorRange record of typeShortInteger 
  774. ;  0x73726365   
  775. keyOSASourceEnd                    EQU        'srce'
  776.  
  777. ; Disposing Script IDs: 
  778. ;
  779. ; pascal OSAError OSADispose(ComponentInstance scriptingComponent, OSAID scriptID)
  780. ;
  781.     IF ¬ GENERATINGCFM THEN
  782.         Macro
  783.         _OSADispose
  784.             dc.w     $2F3C
  785.             dc.w     $0004
  786.             dc.w     $0006
  787.             moveq    #0,d0
  788.             dc.w     $A82A
  789.         EndM
  790.     ELSE
  791.         IMPORT_CFM_FUNCTION    OSADispose
  792.     ENDIF
  793.  
  794. ;
  795. ;        OSAComponentFunctionInline(kOSASelectDispose, 4);
  796. ;        Disposes a script or context.
  797. ;    
  798. ;        Errors:
  799. ;            badComponentInstance    invalid scripting component instance
  800. ;            errOSASystemError
  801. ;            errOSAInvalidID
  802. ;    
  803. ; Getting and Setting Script Information: 
  804. ;
  805. ; pascal OSAError OSASetScriptInfo(ComponentInstance scriptingComponent, OSAID scriptID, OSType selector, long value)
  806. ;
  807.     IF ¬ GENERATINGCFM THEN
  808.         Macro
  809.         _OSASetScriptInfo
  810.             dc.w     $2F3C
  811.             dc.w     $000C
  812.             dc.w     $0007
  813.             moveq    #0,d0
  814.             dc.w     $A82A
  815.         EndM
  816.     ELSE
  817.         IMPORT_CFM_FUNCTION    OSASetScriptInfo
  818.     ENDIF
  819.  
  820. ;
  821. ;        OSAComponentFunctionInline(kOSASelectSetScriptInfo, 12);
  822. ;    
  823. ;        Errors:
  824. ;            badComponentInstance    invalid scripting component instance
  825. ;            errOSASystemError
  826. ;            errOSAInvalidID
  827. ;            errOSABadSelector:        selector not supported by scripting component
  828. ;                                    or selector not for this scriptID
  829. ;    
  830. ;
  831. ; pascal OSAError OSAGetScriptInfo(ComponentInstance scriptingComponent, OSAID scriptID, OSType selector, long *result)
  832. ;
  833.     IF ¬ GENERATINGCFM THEN
  834.         Macro
  835.         _OSAGetScriptInfo
  836.             dc.w     $2F3C
  837.             dc.w     $000C
  838.             dc.w     $0008
  839.             moveq    #0,d0
  840.             dc.w     $A82A
  841.         EndM
  842.     ELSE
  843.         IMPORT_CFM_FUNCTION    OSAGetScriptInfo
  844.     ENDIF
  845.  
  846. ;
  847. ;        OSAComponentFunctionInline(kOSASelectGetScriptInfo, 12);
  848. ;    
  849. ;        Errors:
  850. ;            badComponentInstance    invalid scripting component instance
  851. ;            errOSASystemError
  852. ;            errOSAInvalidID
  853. ;            errOSABadSelector:        selector not supported by scripting component
  854. ;                                    or selector not for this scriptID
  855. ;    
  856. ; Manipulating the ActiveProc:
  857. ;
  858. ;    Scripting systems will supply default values for these procedures if they
  859. ;    are not set by the client:
  860. ;
  861. ;
  862. ; pascal OSAError OSASetActiveProc(ComponentInstance scriptingComponent, OSAActiveUPP activeProc, long refCon)
  863. ;
  864.     IF ¬ GENERATINGCFM THEN
  865.         Macro
  866.         _OSASetActiveProc
  867.             dc.w     $2F3C
  868.             dc.w     $0008
  869.             dc.w     $0009
  870.             moveq    #0,d0
  871.             dc.w     $A82A
  872.         EndM
  873.     ELSE
  874.         IMPORT_CFM_FUNCTION    OSASetActiveProc
  875.     ENDIF
  876.  
  877. ;
  878. ;        OSAComponentFunctionInline(kOSASelectSetActiveProc, 8);
  879. ;        If activeProc is nil, the default activeProc is used.
  880. ;    
  881. ;        Errors:
  882. ;            badComponentInstance    invalid scripting component instance
  883. ;            errOSASystemError
  884. ;    
  885. ;
  886. ; pascal OSAError OSAGetActiveProc(ComponentInstance scriptingComponent, OSAActiveUPP *activeProc, long *refCon)
  887. ;
  888.     IF ¬ GENERATINGCFM THEN
  889.         Macro
  890.         _OSAGetActiveProc
  891.             dc.w     $2F3C
  892.             dc.w     $0008
  893.             dc.w     $000A
  894.             moveq    #0,d0
  895.             dc.w     $A82A
  896.         EndM
  897.     ELSE
  898.         IMPORT_CFM_FUNCTION    OSAGetActiveProc
  899.     ENDIF
  900.  
  901. ;
  902. ;        OSAComponentFunctionInline(kOSASelectGetActiveProc, 8);
  903. ;    
  904. ;        Errors:
  905. ;            badComponentInstance    invalid scripting component instance
  906. ;            errOSASystemError
  907. ;    
  908. ;*************************************************************************
  909. ;    OSA Optional Compiling Interface
  910. ;**************************************************************************
  911. ;    Scripting components that support the Compiling interface have the 
  912. ;    kOSASupportsCompiling bit set in it's ComponentDescription.
  913. ;*************************************************************************
  914. ;
  915. ; pascal OSAError OSAScriptingComponentName(ComponentInstance scriptingComponent, AEDesc *resultingScriptingComponentName)
  916. ;
  917.     IF ¬ GENERATINGCFM THEN
  918.         Macro
  919.         _OSAScriptingComponentName
  920.             dc.w     $2F3C
  921.             dc.w     $0004
  922.             dc.w     $0102
  923.             moveq    #0,d0
  924.             dc.w     $A82A
  925.         EndM
  926.     ELSE
  927.         IMPORT_CFM_FUNCTION    OSAScriptingComponentName
  928.     ENDIF
  929.  
  930. ;
  931. ;        OSAComponentFunctionInline(kOSASelectScriptingComponentName, 4);
  932. ;        Given a scripting component, this routine returns the name of that
  933. ;        scripting component in a type that is coercable to text (typeChar).
  934. ;        The generic scripting component returns the name of the default
  935. ;        scripting component.  This name should be sufficient to convey to the
  936. ;        user the kind of script (syntax) he is expected to write.
  937. ;    
  938. ;        Errors:
  939. ;            badComponentInstance    invalid scripting component instance
  940. ;            errOSASystemError
  941. ;    
  942. ;
  943. ; pascal OSAError OSACompile(ComponentInstance scriptingComponent, const AEDesc *sourceData, long modeFlags, OSAID *previousAndResultingScriptID)
  944. ;
  945.     IF ¬ GENERATINGCFM THEN
  946.         Macro
  947.         _OSACompile
  948.             dc.w     $2F3C
  949.             dc.w     $000C
  950.             dc.w     $0103
  951.             moveq    #0,d0
  952.             dc.w     $A82A
  953.         EndM
  954.     ELSE
  955.         IMPORT_CFM_FUNCTION    OSACompile
  956.     ENDIF
  957.  
  958. ;
  959. ;        OSAComponentFunctionInline(kOSASelectCompile, 12);
  960. ;        Coerces input desc (possibly text) into a script's internal format.
  961. ;        Once compiled, the script is ready to run.  The modeFlags convey
  962. ;        scripting component specific information.  The previous script ID
  963. ;        (result parameter) is made to refer to the newly compiled script,
  964. ;        unless it was originally kOSANullScript.  In this case a new script
  965. ;        ID is created and used.
  966. ;    
  967. ;        Errors:
  968. ;            badComponentInstance    invalid scripting component instance
  969. ;            errOSASystemError
  970. ;            errAECoercionFail:        sourceData is not compilable
  971. ;            errOSAScriptError:        sourceData was a bad script (syntax error)
  972. ;            errOSAInvalidID:        previousAndResultingCompiledScriptID was not
  973. ;                                    valid on input
  974. ;    
  975. ;        ModeFlags:
  976. ;            kOSAModePreventGetSource
  977. ;            kOSAModeCompileIntoContext
  978. ;            kOSAModeAugmentContext
  979. ;            kOSAModeNeverInteract
  980. ;            kOSAModeCanInteract
  981. ;            kOSAModeAlwaysInteract
  982. ;            kOSAModeCantSwitchLayer
  983. ;            kOSAModeDontReconnect
  984. ;            kOSAModeDoRecord
  985. ;    
  986. ;
  987. ; pascal OSAError OSACopyID(ComponentInstance scriptingComponent, OSAID fromID, OSAID *toID)
  988. ;
  989.     IF ¬ GENERATINGCFM THEN
  990.         Macro
  991.         _OSACopyID
  992.             dc.w     $2F3C
  993.             dc.w     $0008
  994.             dc.w     $0104
  995.             moveq    #0,d0
  996.             dc.w     $A82A
  997.         EndM
  998.     ELSE
  999.         IMPORT_CFM_FUNCTION    OSACopyID
  1000.     ENDIF
  1001.  
  1002. ;
  1003. ;        OSAComponentFunctionInline(kOSASelectCopyID, 8);
  1004. ;        If toID is a reference to kOSANullScript then it is updated to have a
  1005. ;        new scriptID value.  This call can be used to perform undo or revert
  1006. ;        operations on scripts. 
  1007. ;    
  1008. ;        Errors:
  1009. ;            badComponentInstance    invalid scripting component instance
  1010. ;            errOSASystemError
  1011. ;            errOSAInvalidID
  1012. ;    
  1013. ;*************************************************************************
  1014. ;    OSA Optional GetSource Interface
  1015. ;**************************************************************************
  1016. ;    Scripting components that support the GetSource interface have the 
  1017. ;    kOSASupportsGetSource bit set in it's ComponentDescription.
  1018. ;*************************************************************************
  1019. ;
  1020. ; pascal OSAError OSAGetSource(ComponentInstance scriptingComponent, OSAID scriptID, DescType desiredType, AEDesc *resultingSourceData)
  1021. ;
  1022.     IF ¬ GENERATINGCFM THEN
  1023.         Macro
  1024.         _OSAGetSource
  1025.             dc.w     $2F3C
  1026.             dc.w     $000C
  1027.             dc.w     $0201
  1028.             moveq    #0,d0
  1029.             dc.w     $A82A
  1030.         EndM
  1031.     ELSE
  1032.         IMPORT_CFM_FUNCTION    OSAGetSource
  1033.     ENDIF
  1034.  
  1035. ;
  1036. ;        OSAComponentFunctionInline(kOSASelectGetSource, 12);
  1037. ;        This routine causes a compiled script to be output in a form (possibly
  1038. ;        text) such that it is suitable to be passed back to OSACompile.
  1039. ;
  1040. ;        Errors:
  1041. ;            badComponentInstance    invalid scripting component instance
  1042. ;            errOSASystemError
  1043. ;            errOSAInvalidID
  1044. ;            errOSASourceNotAvailable    can't get source for this scriptID
  1045. ;    
  1046. ;*************************************************************************
  1047. ;    OSA Optional AECoercion Interface
  1048. ;**************************************************************************
  1049. ;    Scripting components that support the AECoercion interface have the 
  1050. ;    kOSASupportsAECoercion bit set in it's ComponentDescription.
  1051. ;*************************************************************************
  1052. ;
  1053. ; pascal OSAError OSACoerceFromDesc(ComponentInstance scriptingComponent, const AEDesc *scriptData, long modeFlags, OSAID *resultingScriptID)
  1054. ;
  1055.     IF ¬ GENERATINGCFM THEN
  1056.         Macro
  1057.         _OSACoerceFromDesc
  1058.             dc.w     $2F3C
  1059.             dc.w     $000C
  1060.             dc.w     $0301
  1061.             moveq    #0,d0
  1062.             dc.w     $A82A
  1063.         EndM
  1064.     ELSE
  1065.         IMPORT_CFM_FUNCTION    OSACoerceFromDesc
  1066.     ENDIF
  1067.  
  1068. ;
  1069. ;        OSAComponentFunctionInline(kOSASelectCoerceFromDesc, 12);
  1070. ;        This routine causes script data to be coerced into a script value.
  1071. ;        If the scriptData is an AppleEvent, then the resultingScriptID is a
  1072. ;        compiled script ID (mode flags for OSACompile may be used in this case).
  1073. ;        Other scriptData descriptors create script value IDs.
  1074. ;    
  1075. ;        Errors:
  1076. ;            badComponentInstance    invalid scripting component instance
  1077. ;            errOSASystemError
  1078. ;    
  1079. ;        ModeFlags:
  1080. ;            kOSAModePreventGetSource
  1081. ;            kOSAModeCompileIntoContext
  1082. ;            kOSAModeNeverInteract
  1083. ;            kOSAModeCanInteract
  1084. ;            kOSAModeAlwaysInteract
  1085. ;            kOSAModeCantSwitchLayer
  1086. ;            kOSAModeDontReconnect
  1087. ;            kOSAModeDoRecord
  1088. ;    
  1089. ;
  1090. ; pascal OSAError OSACoerceToDesc(ComponentInstance scriptingComponent, OSAID scriptID, DescType desiredType, long modeFlags, AEDesc *result)
  1091. ;
  1092.     IF ¬ GENERATINGCFM THEN
  1093.         Macro
  1094.         _OSACoerceToDesc
  1095.             dc.w     $2F3C
  1096.             dc.w     $0010
  1097.             dc.w     $0302
  1098.             moveq    #0,d0
  1099.             dc.w     $A82A
  1100.         EndM
  1101.     ELSE
  1102.         IMPORT_CFM_FUNCTION    OSACoerceToDesc
  1103.     ENDIF
  1104.  
  1105. ;
  1106. ;        OSAComponentFunctionInline(kOSASelectCoerceToDesc, 16);
  1107. ;        This routine causes a script value to be coerced into any desired form.
  1108. ;        If the scriptID denotes a compiled script, then it may be coerced to 
  1109. ;        typeAppleEvent.
  1110. ;    
  1111. ;        Errors:
  1112. ;            badComponentInstance    invalid scripting component instance
  1113. ;            errOSASystemError
  1114. ;            errOSAInvalidID
  1115. ;    
  1116. ;*************************************************************************
  1117. ;    OSA Optional AESending Interface
  1118. ;**************************************************************************
  1119. ;    Scripting components that support the AESending interface have the 
  1120. ;    kOSASupportsAESending bit set in it's ComponentDescription.
  1121. ;*************************************************************************
  1122. ;
  1123. ;    Scripting systems will supply default values for these procedures if they
  1124. ;    are not set by the client:
  1125. ;
  1126. ;
  1127. ; pascal OSAError OSASetSendProc(ComponentInstance scriptingComponent, OSASendUPP sendProc, long refCon)
  1128. ;
  1129.     IF ¬ GENERATINGCFM THEN
  1130.         Macro
  1131.         _OSASetSendProc
  1132.             dc.w     $2F3C
  1133.             dc.w     $0008
  1134.             dc.w     $0401
  1135.             moveq    #0,d0
  1136.             dc.w     $A82A
  1137.         EndM
  1138.     ELSE
  1139.         IMPORT_CFM_FUNCTION    OSASetSendProc
  1140.     ENDIF
  1141.  
  1142. ;
  1143. ;        OSAComponentFunctionInline(kOSASelectSetSendProc, 8);
  1144. ;        If sendProc is nil, the default sendProc is used.
  1145. ;    
  1146. ;        Errors:
  1147. ;            badComponentInstance    invalid scripting component instance
  1148. ;            errOSASystemError
  1149. ;    
  1150. ;
  1151. ; pascal OSAError OSAGetSendProc(ComponentInstance scriptingComponent, OSASendUPP *sendProc, long *refCon)
  1152. ;
  1153.     IF ¬ GENERATINGCFM THEN
  1154.         Macro
  1155.         _OSAGetSendProc
  1156.             dc.w     $2F3C
  1157.             dc.w     $0008
  1158.             dc.w     $0402
  1159.             moveq    #0,d0
  1160.             dc.w     $A82A
  1161.         EndM
  1162.     ELSE
  1163.         IMPORT_CFM_FUNCTION    OSAGetSendProc
  1164.     ENDIF
  1165.  
  1166. ;
  1167. ;        OSAComponentFunctionInline(kOSASelectGetSendProc, 8);
  1168. ;    
  1169. ;        Errors:
  1170. ;            badComponentInstance    invalid scripting component instance
  1171. ;            errOSASystemError
  1172. ;    
  1173. ;
  1174. ; pascal OSAError OSASetCreateProc(ComponentInstance scriptingComponent, OSACreateAppleEventUPP createProc, long refCon)
  1175. ;
  1176.     IF ¬ GENERATINGCFM THEN
  1177.         Macro
  1178.         _OSASetCreateProc
  1179.             dc.w     $2F3C
  1180.             dc.w     $0008
  1181.             dc.w     $0403
  1182.             moveq    #0,d0
  1183.             dc.w     $A82A
  1184.         EndM
  1185.     ELSE
  1186.         IMPORT_CFM_FUNCTION    OSASetCreateProc
  1187.     ENDIF
  1188.  
  1189. ;
  1190. ;        OSAComponentFunctionInline(kOSASelectSetCreateProc, 8);
  1191. ;        If createProc is nil, the default createProc is used.
  1192. ;    
  1193. ;        Errors:
  1194. ;            badComponentInstance    invalid scripting component instance
  1195. ;            errOSASystemError
  1196. ;    
  1197. ;
  1198. ; pascal OSAError OSAGetCreateProc(ComponentInstance scriptingComponent, OSACreateAppleEventUPP *createProc, long *refCon)
  1199. ;
  1200.     IF ¬ GENERATINGCFM THEN
  1201.         Macro
  1202.         _OSAGetCreateProc
  1203.             dc.w     $2F3C
  1204.             dc.w     $0008
  1205.             dc.w     $0404
  1206.             moveq    #0,d0
  1207.             dc.w     $A82A
  1208.         EndM
  1209.     ELSE
  1210.         IMPORT_CFM_FUNCTION    OSAGetCreateProc
  1211.     ENDIF
  1212.  
  1213. ;
  1214. ;        OSAComponentFunctionInline(kOSASelectGetCreateProc, 8);
  1215. ;    
  1216. ;        Errors:
  1217. ;            badComponentInstance    invalid scripting component instance
  1218. ;            errOSASystemError
  1219. ;    
  1220. ;
  1221. ; pascal OSAError OSASetDefaultTarget(ComponentInstance scriptingComponent, const AEAddressDesc *target)
  1222. ;
  1223.     IF ¬ GENERATINGCFM THEN
  1224.         Macro
  1225.         _OSASetDefaultTarget
  1226.             dc.w     $2F3C
  1227.             dc.w     $0004
  1228.             dc.w     $0405
  1229.             moveq    #0,d0
  1230.             dc.w     $A82A
  1231.         EndM
  1232.     ELSE
  1233.         IMPORT_CFM_FUNCTION    OSASetDefaultTarget
  1234.     ENDIF
  1235.  
  1236. ;
  1237. ;        OSAComponentFunctionInline(kOSASelectSetDefaultTarget, 4);
  1238. ;        This routine sets the default target application for AE sending.
  1239. ;        It also establishes the default target from which terminologies come.
  1240. ;        It is effectively like having an AppleScript "tell" statement around
  1241. ;        the entire program.  If this routine is not called, or if the target 
  1242. ;        is a null AEDesc, then the current application is the default target.
  1243. ;    
  1244. ;        Errors:
  1245. ;            badComponentInstance    invalid scripting component instance
  1246. ;            errOSASystemError
  1247. ;    
  1248. ;*************************************************************************
  1249. ;    OSA Optional Recording Interface
  1250. ;**************************************************************************
  1251. ;    Scripting components that support the Recording interface have the 
  1252. ;    kOSASupportsRecording bit set in it's ComponentDescription.
  1253. ;*************************************************************************
  1254. ;
  1255. ; pascal OSAError OSAStartRecording(ComponentInstance scriptingComponent, OSAID *compiledScriptToModifyID)
  1256. ;
  1257.     IF ¬ GENERATINGCFM THEN
  1258.         Macro
  1259.         _OSAStartRecording
  1260.             dc.w     $2F3C
  1261.             dc.w     $0004
  1262.             dc.w     $0501
  1263.             moveq    #0,d0
  1264.             dc.w     $A82A
  1265.         EndM
  1266.     ELSE
  1267.         IMPORT_CFM_FUNCTION    OSAStartRecording
  1268.     ENDIF
  1269.  
  1270. ;
  1271. ;        OSAComponentFunctionInline(kOSASelectStartRecording, 4);
  1272. ;        Starts recording.  If compiledScriptToModifyID is kOSANullScript, a
  1273. ;        new script ID is created and returned.  If the current application has
  1274. ;        a handler for the kOSARecordedText event, then kOSARecordedText events
  1275. ;        are sent to the application containing the text of each AppleEvent 
  1276. ;        recorded.
  1277. ;    
  1278. ;        Errors:
  1279. ;            badComponentInstance    invalid scripting component instance
  1280. ;            errOSASystemError
  1281. ;            errOSAInvalidID
  1282. ;            errOSARecordingIsAlreadyOn
  1283. ;    
  1284. ;
  1285. ; pascal OSAError OSAStopRecording(ComponentInstance scriptingComponent, OSAID compiledScriptID)
  1286. ;
  1287.     IF ¬ GENERATINGCFM THEN
  1288.         Macro
  1289.         _OSAStopRecording
  1290.             dc.w     $2F3C
  1291.             dc.w     $0004
  1292.             dc.w     $0502
  1293.             moveq    #0,d0
  1294.             dc.w     $A82A
  1295.         EndM
  1296.     ELSE
  1297.         IMPORT_CFM_FUNCTION    OSAStopRecording
  1298.     ENDIF
  1299.  
  1300. ;
  1301. ;        OSAComponentFunctionInline(kOSASelectStopRecording, 4);
  1302. ;        If compiledScriptID is not being recorded into or recording is not
  1303. ;        currently on, no error is returned.
  1304. ;    
  1305. ;        Errors:
  1306. ;            badComponentInstance    invalid scripting component instance
  1307. ;            errOSASystemError
  1308. ;            errOSAInvalidID
  1309. ;    
  1310. ;*************************************************************************
  1311. ;    OSA Optional Convenience Interface
  1312. ;**************************************************************************
  1313. ;    Scripting components that support the Convenience interface have the 
  1314. ;    kOSASupportsConvenience bit set in it's ComponentDescription.
  1315. ;*************************************************************************
  1316. ;
  1317. ; pascal OSAError OSALoadExecute(ComponentInstance scriptingComponent, const AEDesc *scriptData, OSAID contextID, long modeFlags, OSAID *resultingScriptValueID)
  1318. ;
  1319.     IF ¬ GENERATINGCFM THEN
  1320.         Macro
  1321.         _OSALoadExecute
  1322.             dc.w     $2F3C
  1323.             dc.w     $0010
  1324.             dc.w     $0601
  1325.             moveq    #0,d0
  1326.             dc.w     $A82A
  1327.         EndM
  1328.     ELSE
  1329.         IMPORT_CFM_FUNCTION    OSALoadExecute
  1330.     ENDIF
  1331.  
  1332. ;
  1333. ;        OSAComponentFunctionInline(kOSASelectLoadExecute, 16);
  1334. ;        This routine is effectively equivalent to calling OSALoad followed by
  1335. ;        OSAExecute.  After execution, the compiled source is disposed.  Only the
  1336. ;        resulting value ID is retained.
  1337. ;    
  1338. ;        Errors:
  1339. ;            badComponentInstance        invalid scripting component instance
  1340. ;            errOSASystemError
  1341. ;            errOSABadStorageType:        scriptData not for this scripting component
  1342. ;            errOSACorruptData:            data seems to be corrupt
  1343. ;            errOSADataFormatObsolete    script data format is no longer supported
  1344. ;            errOSADataFormatTooNew        script data format is from a newer version
  1345. ;            errOSAInvalidID
  1346. ;            errOSAScriptError:            the executing script got an error
  1347. ;    
  1348. ;        ModeFlags:
  1349. ;            kOSAModeNeverInteract
  1350. ;            kOSAModeCanInteract
  1351. ;            kOSAModeAlwaysInteract
  1352. ;            kOSAModeCantSwitchLayer
  1353. ;            kOSAModeDontReconnect
  1354. ;            kOSAModeDoRecord
  1355. ;    
  1356. ;
  1357. ; pascal OSAError OSACompileExecute(ComponentInstance scriptingComponent, const AEDesc *sourceData, OSAID contextID, long modeFlags, OSAID *resultingScriptValueID)
  1358. ;
  1359.     IF ¬ GENERATINGCFM THEN
  1360.         Macro
  1361.         _OSACompileExecute
  1362.             dc.w     $2F3C
  1363.             dc.w     $0010
  1364.             dc.w     $0602
  1365.             moveq    #0,d0
  1366.             dc.w     $A82A
  1367.         EndM
  1368.     ELSE
  1369.         IMPORT_CFM_FUNCTION    OSACompileExecute
  1370.     ENDIF
  1371.  
  1372. ;
  1373. ;        OSAComponentFunctionInline(kOSASelectCompileExecute, 16);
  1374. ;        This routine is effectively equivalent to calling OSACompile followed by
  1375. ;        OSAExecute.  After execution, the compiled source is disposed.  Only the
  1376. ;        resulting value ID is retained.
  1377. ;    
  1378. ;        Errors:
  1379. ;            badComponentInstance    invalid scripting component instance
  1380. ;            errOSASystemError
  1381. ;            errAECoercionFail:        sourceData is not compilable
  1382. ;            errOSAScriptError:        sourceData was a bad script (syntax error)
  1383. ;            errOSAInvalidID:        previousAndResultingCompiledScriptID was not
  1384. ;                                    valid on input
  1385. ;            errOSAScriptError:        the executing script got an error
  1386. ;    
  1387. ;        ModeFlags:
  1388. ;            kOSAModeNeverInteract
  1389. ;            kOSAModeCanInteract
  1390. ;            kOSAModeAlwaysInteract
  1391. ;            kOSAModeCantSwitchLayer
  1392. ;            kOSAModeDontReconnect
  1393. ;            kOSAModeDoRecord
  1394. ;    
  1395. ;
  1396. ; pascal OSAError OSADoScript(ComponentInstance scriptingComponent, const AEDesc *sourceData, OSAID contextID, DescType desiredType, long modeFlags, AEDesc *resultingText)
  1397. ;
  1398.     IF ¬ GENERATINGCFM THEN
  1399.         Macro
  1400.         _OSADoScript
  1401.             dc.w     $2F3C
  1402.             dc.w     $0014
  1403.             dc.w     $0603
  1404.             moveq    #0,d0
  1405.             dc.w     $A82A
  1406.         EndM
  1407.     ELSE
  1408.         IMPORT_CFM_FUNCTION    OSADoScript
  1409.     ENDIF
  1410.  
  1411. ;
  1412. ;        OSAComponentFunctionInline(kOSASelectDoScript, 20);
  1413. ;        This routine is effectively equivalent to calling OSACompile followed by
  1414. ;        OSAExecute and then OSADisplay.  After execution, the compiled source
  1415. ;        and the resulting value are is disposed.  Only the resultingText
  1416. ;        descriptor is retained.  If a script error occur during processing, the 
  1417. ;        resultingText gets the error message of the error, and errOSAScriptError
  1418. ;        is returned.  OSAScriptError may still be used to extract more 
  1419. ;        information about the particular error.
  1420. ;    
  1421. ;        Errors:
  1422. ;            badComponentInstance    invalid scripting component instance
  1423. ;            errOSASystemError
  1424. ;            errAECoercionFail:        sourceData is not compilable or 
  1425. ;                                    desiredType not supported by scripting component
  1426. ;            errOSAScriptError:        sourceData was a bad script (syntax error)
  1427. ;            errOSAInvalidID:        previousAndResultingCompiledScriptID was not
  1428. ;                                    valid on input
  1429. ;            errOSAScriptError:        the executing script got an error
  1430. ;    
  1431. ;        ModeFlags:
  1432. ;            kOSAModeNeverInteract
  1433. ;            kOSAModeCanInteract
  1434. ;            kOSAModeAlwaysInteract
  1435. ;            kOSAModeCantSwitchLayer
  1436. ;            kOSAModeDontReconnect
  1437. ;            kOSAModeDoRecord
  1438. ;            kOSAModeDisplayForHumans
  1439. ;    
  1440. ;*************************************************************************
  1441. ;    OSA Optional Dialects Interface
  1442. ;**************************************************************************
  1443. ;    Scripting components that support the Dialects interface have the 
  1444. ;    kOSASupportsDialects bit set in it's ComponentDescription.
  1445. ;*************************************************************************
  1446. ;
  1447. ;    These calls allows an scripting component that supports different dialects
  1448. ;    to dynamically switch between those dialects.  Although this interface is
  1449. ;    specified, the particular dialect codes are scripting component dependent.
  1450. ;
  1451. ;
  1452. ; pascal OSAError OSASetCurrentDialect(ComponentInstance scriptingComponent, short dialectCode)
  1453. ;
  1454.     IF ¬ GENERATINGCFM THEN
  1455.         Macro
  1456.         _OSASetCurrentDialect
  1457.             dc.w     $2F3C
  1458.             dc.w     $0002
  1459.             dc.w     $0701
  1460.             moveq    #0,d0
  1461.             dc.w     $A82A
  1462.         EndM
  1463.     ELSE
  1464.         IMPORT_CFM_FUNCTION    OSASetCurrentDialect
  1465.     ENDIF
  1466.  
  1467. ;
  1468. ;        OSAComponentFunctionInline(kOSASelectSetCurrentDialect, 2);
  1469. ;    
  1470. ;        Errors:
  1471. ;            badComponentInstance    invalid scripting component instance
  1472. ;            errOSASystemError
  1473. ;            errOSANoSuchDialect:    invalid dialectCode
  1474. ;    
  1475. ;
  1476. ; pascal OSAError OSAGetCurrentDialect(ComponentInstance scriptingComponent, short *resultingDialectCode)
  1477. ;
  1478.     IF ¬ GENERATINGCFM THEN
  1479.         Macro
  1480.         _OSAGetCurrentDialect
  1481.             dc.w     $2F3C
  1482.             dc.w     $0004
  1483.             dc.w     $0702
  1484.             moveq    #0,d0
  1485.             dc.w     $A82A
  1486.         EndM
  1487.     ELSE
  1488.         IMPORT_CFM_FUNCTION    OSAGetCurrentDialect
  1489.     ENDIF
  1490.  
  1491. ;
  1492. ;        OSAComponentFunctionInline(kOSASelectGetCurrentDialect, 4);
  1493. ;    
  1494. ;        Errors:
  1495. ;            badComponentInstance    invalid scripting component instance
  1496. ;            errOSASystemError
  1497. ;    
  1498. ;
  1499. ; pascal OSAError OSAAvailableDialects(ComponentInstance scriptingComponent, AEDesc *resultingDialectInfoList)
  1500. ;
  1501.     IF ¬ GENERATINGCFM THEN
  1502.         Macro
  1503.         _OSAAvailableDialects
  1504.             dc.w     $2F3C
  1505.             dc.w     $0004
  1506.             dc.w     $0703
  1507.             moveq    #0,d0
  1508.             dc.w     $A82A
  1509.         EndM
  1510.     ELSE
  1511.         IMPORT_CFM_FUNCTION    OSAAvailableDialects
  1512.     ENDIF
  1513.  
  1514. ;
  1515. ;        OSAComponentFunctionInline(kOSASelectAvailableDialects, 4);
  1516. ;        This call return an AEList containing information about each of the
  1517. ;        currently available dialects of a scripting component.  Each item
  1518. ;        is an AERecord of typeOSADialectInfo that contains at least the fields
  1519. ;        keyOSADialectName, keyOSADialectCode, KeyOSADialectLangCode and 
  1520. ;        keyOSADialectScriptCode.
  1521. ;    
  1522. ;        Errors:
  1523. ;            badComponentInstance    invalid scripting component instance
  1524. ;            errOSASystemError
  1525. ;    
  1526. ;
  1527. ; pascal OSAError OSAGetDialectInfo(ComponentInstance scriptingComponent, short dialectCode, OSType selector, AEDesc *resultingDialectInfo)
  1528. ;
  1529.     IF ¬ GENERATINGCFM THEN
  1530.         Macro
  1531.         _OSAGetDialectInfo
  1532.             dc.w     $2F3C
  1533.             dc.w     $000A
  1534.             dc.w     $0704
  1535.             moveq    #0,d0
  1536.             dc.w     $A82A
  1537.         EndM
  1538.     ELSE
  1539.         IMPORT_CFM_FUNCTION    OSAGetDialectInfo
  1540.     ENDIF
  1541.  
  1542. ;
  1543. ;        OSAComponentFunctionInline(kOSASelectGetDialectInfo, 10);
  1544. ;        This call gives information about the specified dialect of a scripting
  1545. ;        component. It returns an AEDesc whose type depends on the selector 
  1546. ;        specified. Available selectors are the same as the field keys for a
  1547. ;        dialect info record. The type of AEDesc returned is the same as the 
  1548. ;        type of the field that has same key as the selector.
  1549. ;    
  1550. ;        Errors:
  1551. ;            badComponentInstance    invalid scripting component instance
  1552. ;            errOSASystemError
  1553. ;             errOSABadSelector
  1554. ;            errOSANoSuchDialect:    invalid dialectCode
  1555. ;    
  1556. ;
  1557. ; pascal OSAError OSAAvailableDialectCodeList(ComponentInstance scriptingComponent, AEDesc *resultingDialectCodeList)
  1558. ;
  1559.     IF ¬ GENERATINGCFM THEN
  1560.         Macro
  1561.         _OSAAvailableDialectCodeList
  1562.             dc.w     $2F3C
  1563.             dc.w     $0004
  1564.             dc.w     $0705
  1565.             moveq    #0,d0
  1566.             dc.w     $A82A
  1567.         EndM
  1568.     ELSE
  1569.         IMPORT_CFM_FUNCTION    OSAAvailableDialectCodeList
  1570.     ENDIF
  1571.  
  1572. ;
  1573. ;        OSAComponentFunctionInline(kOSASelectAvailableDialectCodeList, 4);
  1574. ;        This is alternative to OSAGetAvailableDialectCodeList. Use this call
  1575. ;        and  OSAGetDialectInfo to get information on dialects.
  1576. ;        This call return an AEList containing dialect code for each of the
  1577. ;        currently available dialects of a scripting component. Each dialect
  1578. ;        code is a short integer of type typeShortInteger.
  1579. ;    
  1580. ;        Errors:
  1581. ;            badComponentInstance    invalid scripting component instance
  1582. ;            errOSASystemError
  1583. ;
  1584. ;        Type of a dialect info record containing at least keyOSADialectName
  1585. ;        and keyOSADialectCode fields.
  1586. ;
  1587. ;        keys for dialect info record, also used as selectors to OSAGetDialectInfo.
  1588. ;
  1589. ;        Field of a typeOSADialectInfo record of typeChar.
  1590. ;        Field of a typeOSADialectInfo record of typeShortInteger.
  1591. ;        Field of a typeOSADialectInfo record of typeShortInteger.
  1592. ;        Field of a typeOSADialectInfo record of typeShortInteger.
  1593. ;    
  1594. ;*************************************************************************
  1595. ;    OSA Optional Event Handling Interface
  1596. ;**************************************************************************
  1597. ;    Scripting components that support the Event Handling interface have the 
  1598. ;    kOSASupportsEventHandling bit set in it's ComponentDescription.
  1599. ;*************************************************************************
  1600. ;
  1601. ; pascal OSAError OSASetResumeDispatchProc(ComponentInstance scriptingComponent, AEEventHandlerUPP resumeDispatchProc, long refCon)
  1602. ;
  1603.     IF ¬ GENERATINGCFM THEN
  1604.         Macro
  1605.         _OSASetResumeDispatchProc
  1606.             dc.w     $2F3C
  1607.             dc.w     $0008
  1608.             dc.w     $0801
  1609.             moveq    #0,d0
  1610.             dc.w     $A82A
  1611.         EndM
  1612.     ELSE
  1613.         IMPORT_CFM_FUNCTION    OSASetResumeDispatchProc
  1614.     ENDIF
  1615.  
  1616. ;
  1617. ;        OSAComponentFunctionInline(kOSASelectSetResumeDispatchProc, 8);
  1618. ;        This function is used to set the ResumeDispatchProc that will be used
  1619. ;        by OSAExecuteEvent and OSADoEvent if either no event handler can be
  1620. ;        found in the context, or the context event hander "continues" control
  1621. ;        onward. The two constants kOSAUseStandardDispatch and kOSANoDispatch
  1622. ;        may also be passed to this routine indicating that the handler registered
  1623. ;        in the application with AEInstallEventHandler should be used, or no
  1624. ;        dispatch should occur, respectively.
  1625. ;    
  1626. ;        Errors:
  1627. ;            badComponentInstance    invalid scripting component instance
  1628. ;            errOSASystemError
  1629. ;    
  1630. kOSAUseStandardDispatch            EQU        kAEUseStandardDispatch
  1631.  
  1632. ;
  1633. ;        Special ResumeDispatchProc constant which may be passed to 
  1634. ;        OSASetResumeDispatchProc indicating that the handler registered
  1635. ;        in the application with AEInstallEventHandler should be used.
  1636. ;        
  1637. ;        NOTE:    Had to remove the cast (AEEventHandlerUPP).  The C compiler
  1638. ;                doesn't allow pointer types to be assigned to an enum.  All
  1639. ;                constants must be assigned as enums to translate properly to
  1640. ;                Pascal.
  1641. ;    
  1642. kOSANoDispatch                    EQU        kAENoDispatch
  1643.  
  1644. ;
  1645. ;        Special ResumeDispatchProc constant which may be passed to 
  1646. ;        OSASetResumeDispatchProc indicating that no dispatch should occur.
  1647. ;        
  1648. ;        NOTE:    Had to remove the cast (AEEventHandlerUPP).  The C compiler
  1649. ;                doesn't allow pointer types to be assigned to an enum.  All
  1650. ;                constants must be assigned as enums to translate properly to
  1651. ;                Pascal.
  1652. ;    
  1653. kOSADontUsePhac                    EQU        $0001
  1654.  
  1655. ;
  1656. ;        Special refCon constant that may be given to OSASetResumeDispatchProc
  1657. ;        only when kOSAUseStandardDispatch is used as the ResumeDispatchProc.
  1658. ;        This causes the standard dispatch to be performed, except the phac
  1659. ;        handler is not called.  This is useful during tinkerability, when
  1660. ;        the phac handler is used to lookup a context associated with an event's 
  1661. ;        direct parameter, and call OSAExecuteEvent or OSADoEvent.  Failure to
  1662. ;        bypass the phac handler would result in an infinite loop.
  1663. ;    
  1664. ;
  1665. ; pascal OSAError OSAGetResumeDispatchProc(ComponentInstance scriptingComponent, AEEventHandlerUPP *resumeDispatchProc, long *refCon)
  1666. ;
  1667.     IF ¬ GENERATINGCFM THEN
  1668.         Macro
  1669.         _OSAGetResumeDispatchProc
  1670.             dc.w     $2F3C
  1671.             dc.w     $0008
  1672.             dc.w     $0802
  1673.             moveq    #0,d0
  1674.             dc.w     $A82A
  1675.         EndM
  1676.     ELSE
  1677.         IMPORT_CFM_FUNCTION    OSAGetResumeDispatchProc
  1678.     ENDIF
  1679.  
  1680. ;
  1681. ;        OSAComponentFunctionInline(kOSASelectGetResumeDispatchProc, 8);
  1682. ;        Returns the registered ResumeDispatchProc.  If no ResumeDispatchProc has
  1683. ;        been registered, then kOSAUseStandardDispatch (the default) is returned.
  1684. ;    
  1685. ;        Errors:
  1686. ;            badComponentInstance    invalid scripting component instance
  1687. ;            errOSASystemError
  1688. ;    
  1689. ;
  1690. ; pascal OSAError OSAExecuteEvent(ComponentInstance scriptingComponent, const AppleEvent *theAppleEvent, OSAID contextID, long modeFlags, OSAID *resultingScriptValueID)
  1691. ;
  1692.     IF ¬ GENERATINGCFM THEN
  1693.         Macro
  1694.         _OSAExecuteEvent
  1695.             dc.w     $2F3C
  1696.             dc.w     $0010
  1697.             dc.w     $0803
  1698.             moveq    #0,d0
  1699.             dc.w     $A82A
  1700.         EndM
  1701.     ELSE
  1702.         IMPORT_CFM_FUNCTION    OSAExecuteEvent
  1703.     ENDIF
  1704.  
  1705. ;
  1706. ;        OSAComponentFunctionInline(kOSASelectExecuteEvent, 16);
  1707. ;        This call is similar to OSAExecute except the initial command to
  1708. ;        execute comes in the form of an AppleEvent.  If the contextID
  1709. ;        defines any event handlers for that event, they are used to process
  1710. ;        the event.  If no event handler can be found in the context
  1711. ;        errAEEventNotHandled is returned.  If an event handler is found and
  1712. ;        the hander "continues" control onward, the ResumeDispatchProc
  1713. ;        (registered with OSASetResumeDispatchProc, above) is called given the
  1714. ;        AppleEvent.  The result is returned as a scriptValueID.
  1715. ;    
  1716. ;        Errors:
  1717. ;            badComponentInstance    invalid scripting component instance
  1718. ;            errOSASystemError
  1719. ;            errOSAInvalidID
  1720. ;            errOSAScriptError:        the executing script got an error
  1721. ;            errAEEventNotHandled:    no handler for event in contextID
  1722. ;    
  1723. ;        ModeFlags:
  1724. ;            kOSAModeNeverInteract
  1725. ;            kOSAModeCanInteract
  1726. ;            kOSAModeAlwaysInteract
  1727. ;            kOSAModeCantSwitchLayer
  1728. ;            kOSAModeDontReconnect
  1729. ;            kOSAModeDoRecord
  1730. ;    
  1731. ;
  1732. ; pascal OSAError OSADoEvent(ComponentInstance scriptingComponent, const AppleEvent *theAppleEvent, OSAID contextID, long modeFlags, AppleEvent *reply)
  1733. ;
  1734.     IF ¬ GENERATINGCFM THEN
  1735.         Macro
  1736.         _OSADoEvent
  1737.             dc.w     $2F3C
  1738.             dc.w     $0010
  1739.             dc.w     $0804
  1740.             moveq    #0,d0
  1741.             dc.w     $A82A
  1742.         EndM
  1743.     ELSE
  1744.         IMPORT_CFM_FUNCTION    OSADoEvent
  1745.     ENDIF
  1746.  
  1747. ;
  1748. ;        OSAComponentFunctionInline(kOSASelectDoEvent, 16);
  1749. ;        This call is similar to OSADoScript except the initial command to
  1750. ;        execute comes in the form of an AppleEvent, and the result is an 
  1751. ;        AppleEvent reply record.  If the contextID defines any event handlers
  1752. ;        for that event, they are used to process the event.  If no event handler
  1753. ;        can be found in the context errAEEventNotHandled is returned.  If an
  1754. ;        event handler is found and the hander "continues" control onward, the
  1755. ;        ResumeDispatchProc (registered with OSASetResumeDispatchProc, above) is
  1756. ;        called given the AppleEvent.  The result is returned in the form of an
  1757. ;        AppleEvent reply descriptor. If at any time the script gets an error, or
  1758. ;        if the ResumeDispatchProc returns a reply event indicating an error,
  1759. ;        then the OSADoEvent call itself returns an error reply (i.e. OSADoEvent
  1760. ;        should never return errOSAScriptError).  Any error result returned by
  1761. ;        the ResumeDispatchProc will be returned by OSADoEvent.
  1762. ;    
  1763. ;        Errors:
  1764. ;            badComponentInstance    invalid scripting component instance
  1765. ;            errOSASystemError
  1766. ;            errOSAInvalidID
  1767. ;            errAEEventNotHandled:    no handler for event in contextID
  1768. ;    
  1769. ;        ModeFlags:
  1770. ;            kOSAModeNeverInteract
  1771. ;            kOSAModeCanInteract
  1772. ;            kOSAModeAlwaysInteract
  1773. ;            kOSAModeCantSwitchLayer
  1774. ;            kOSAModeDontReconnect
  1775. ;            kOSAModeDoRecord
  1776. ;    
  1777. ;
  1778. ; pascal OSAError OSAMakeContext(ComponentInstance scriptingComponent, const AEDesc *contextName, OSAID parentContext, OSAID *resultingContextID)
  1779. ;
  1780.     IF ¬ GENERATINGCFM THEN
  1781.         Macro
  1782.         _OSAMakeContext
  1783.             dc.w     $2F3C
  1784.             dc.w     $000C
  1785.             dc.w     $0805
  1786.             moveq    #0,d0
  1787.             dc.w     $A82A
  1788.         EndM
  1789.     ELSE
  1790.         IMPORT_CFM_FUNCTION    OSAMakeContext
  1791.     ENDIF
  1792.  
  1793. ;
  1794. ;        OSAComponentFunctionInline(kOSASelectMakeContext, 12);
  1795. ;        Makes a new empty context which may be passed to OSAExecute or 
  1796. ;        OSAExecuteEvent.  If contextName is typeNull, an unnamed context is
  1797. ;        created. If parentContext is kOSANullScript then the resulting context
  1798. ;        does not inherit bindings from any other context.
  1799. ;    
  1800. ;        Errors:
  1801. ;            badComponentInstance    invalid scripting component instance
  1802. ;            errOSASystemError
  1803. ;            errOSAInvalidID
  1804. ;            errAECoercionFail:        contextName is invalid
  1805. ;    
  1806.     ENDIF ; __OSA__
  1807.